home *** CD-ROM | disk | FTP | other *** search
- situation planetary_bombardment_ship
- vars
- p : planet;
- s : structure;
- a : integer;
- weakest : structure;
- bomb : integer;
- success : boolean;
-
- begin
- // First see if the planet is an enemy race
- if (Orbit_owner(This_planet()) <> Planet_race(This_planet())) then
- begin
- // Find a structure on the planet to bombard with the weakest armor
- p := This_planet();
- weakest := First_structure(p);
- if (weakest <> nil) then
- begin
- s := Next_structure(p, weakest);
- while (s <> nil) do
- begin
- if (Structure_armor(p, s) < Structure_armor(p, weakest)) then
- weakest := s;
- else if ((Structure_armor(p, s) = Structure_armor(p, weakest)) and
- (Random(4) = 0)) then
- weakest := s;
- s := Next_structure(p, s);
- end;
- bomb := Structure_hex(p, weakest);
- success := Bombard_planet(bomb);
- end;
- end;
- end;